package main;

import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.util.List;

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManagerFactory;

import dao.SongDAO;

import jdo.InsertSongAndMembers;


import systemServer.general.IConnection;
import systemServer.general.SystemFacade;
import systemServer.members.FindMember;
import systemServer.reproduction.FindSong;
import systemServer.reproduction.Song;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		if (args.length != 4) {
			System.exit(0);
		}

		if (System.getSecurityManager() == null) {
			System.setSecurityManager(new RMISecurityManager());
		}

		String nameConnection= "//" + args[0] + ":" + args[1] + "/" + args[2];

		//FIME hXay que saber como usar los finders, cuando poblarlos etc
		
		try {						
			IConnection facade = new SystemFacade (args);
			Naming.rebind(nameConnection, facade);
		//	System.out.println(FindSong.getArtistSongs("John Lennon"));
			System.out.println("System service '" + nameConnection + "' active and waiting...");
		} catch (Exception e) {
			System.err.println("SERVICE Exception: " + e.getMessage());
			e.printStackTrace();
		}
		

	}

}
